/**
 * 定义的类型名字命名--大驼峰-首字母大写（结尾是大写的T方便辨识）==> 全局
 * 1 只有2-5种字符串的可能性，就写【枚举类型】。
 * 2 有相同的类型就写 【继承类型】
 * 3 定义【对象类型】--key是动态的时候 { } filterDataObj：Record<string, any>
 * 4 【map 结构】: flawTypeAllMap: Map<string, flawTypeCommon>
 */

import { number } from 'echarts';

export enum DatePickerT {
  year = 'year',
  month = 'month',
  week = 'week',
  day = 'day'
}
export type AnanlyseTimeT = {
  time: Array<string>;
  type: DatePickerT;
};
export type TimeDuringT = {
  startTime: string;
  endTime: string;
};
export enum DatePickerFormartT {
  year = 'YYYY',
  month = 'YYYY-MM',
  week = 'YYYY-WW',
  day = 'YYYY-MM-DD'
}
export enum TagTypeConfT {
  strict_reason = 'strict_reason',
  strict_flaw = 'strict_flaw',
  loose_reason = 'loose_reason',
  loose_flaw = 'loose_flaw'
}
export type FlawDetailColumnT = {
  title: string;
  dataIndex: string;
  key: string;
};
export type PageConfT = {
  pageSize: number;
  pageNum: number;
};
export type SheetTagStructT = {
  strict: boolean;
  loose: boolean;
};
export interface FlawDetailQueryStructT {
  startTime?: string;
  endTime?: string;
  pageSize?: number;
  pageNum?: number;
  tag: boolean;
  sheetTag: SheetTagStructT;
  lotId?: string;
  checkedFlawList: Array<string>;
  fields?: Array<string>;
}

// 继承类型
export interface flawTypeCommonT {
  color?: string;
  count?: number;
  id: number;
  name: string;
  symbol?: string;
  shape?: number;
}

// 缺陷类型的symbol
export interface flawTypeCountSymbol extends flawTypeCommonT {
  children?: Array<flawTypeCommonT>;
}

// --------------
export interface treeSelectOptionType {
  value: string | number;
  title: string;
  children?: Array<{ value: string | number; title: string }>;
}

export interface valLabT {
  value: string;
  label: string;
}

// marking传来的后端数据结构
export interface markingBackT {
  // 10个大卷
  layerId: string;
  grad: string;
  layerHeight: number | string;
  layerWidth: number | string;
  lotList: Array<lotListT>;
}

export interface lotListT {
  lotId: string;
  yield: number;
  polMarkingSum: number;
  polPositionExactSum: number;
  polPositionExactRatio: number;
  polPatternExactSum: number;
  polPatternExactRatio: number;
  polPiantiehouOkSum: number;
  polPiantiehouOkRatio: number;
  lotHeight: number | string;
  lotWidth: number | string;
  size: number;
  sizeLong: number;
  sizeShort: number;
  markingSum: number;
  markingList: Array<markingListT>;
}
export interface markingListT {
  // 小卷下面很多marking信息
  // lotId
  lotId: string;
  // Model
  model?: string; //后端不返回了，但是前端需要做处理
  //markingId
  markingId: number;
  // 不良名称
  markingType: string;
  // Marking数量
  markingCount: number;
  // Marking准确数
  markingExactCount: number;
  //Marking准确率
  markingExactRatio: number;
  // Marking过检数
  markingOverCount: number;
  // Marking过检率
  markingOverRatio: number;
  // POL检出量
  polCheckCount: number;
  // POL检出率
  polCheckRatio: number;
  // POL漏检量
  polMissCount: number;
  // POL漏检率
  polMissRatio: number;
  // 偏贴后NG 片 markihng总数
  piantiehouNgPanelMarkingSum: number;
}

//处理后的卷展开数据
export interface marklotDataT {
  layerId: string;
  grad: string;
  lotId: string;
  dimensionsSize: string;
  lotHeight: number | string;
  yield: number;
  markingSum: number;
  key: string;
  markingExactCount: number;
  model: string;
  markingType: string;
  markingCount: number;
  polMarkingSum: number;
  polPositionExactSum: number;
  polPositionExactRatio: string;
  polPatternExactSum: number;
  polPatternExactRatio: string;
  polPiantiehouOkSum: number;
  polPiantiehouOkRatio: string;
  markingExactRatio: string;
  markingOverCount: number;
  markingOverRatio: string;
  polCheckCount: number;
  polCheckRatio: string;
  polMissCount: number;
  polMissRatio: string;
  piantiehouNgPanelMarkingSum: number;
}

export enum MarkingPageQueryT {
  time = 'time',
  lot = 'lot'
}

export enum FtpPageQueryT {
  time = 'time',
  lotId = 'lotId'
}

// 三个工站的缺陷类型
export enum FlawTypeSiteT {
  doff = 'doff',
  pol = 'pol',
  piantiehou = 'piantiehou'
}

export enum FlawFilterDialogT {
  layerId = 'layerId',
  lotDetail = 'lotDetail'
}

export enum EchartFlawMapT {
  lotFlawMap = 'lotFlawMap',
  sheetFlawMap = 'sheetFlawMap'
}

export enum FlawFilterType {
  map = 'map',
  lotId = 'lotId'
}

export interface flawTypeT {
  color?: string;
  flawType: number;
  name?: string;
  symbol?: string;
}
export interface flawTypeIdT {
  sheetId: number;
  flawType: number;
  uid: number;
  doffCd: number;
  doffMd: number;
  lotId: string;
}

export interface echartValT {
  x_y: Array<number>;
  color: string;
  icon: string;
  name: string;
  sheetId: string;
  flawType: number;
  uid: number;
  station: string;
  lotId: string;
}

export interface layerFlawMapDotT {
  flawType: number;
  lotId: string;
  doffCd: number;
  doffMd: number;
}

export interface layerFlawMapEchartValT {
  x_y: Array<number>;
  color: string;
  icon: string;
  name: string;
  flawType: number;
  lotId: string;
}

export interface LotHeadLabelT {
  label: string;
  key: string;
  value: string;
}

//-请求类型的参数----查询卷缺陷信息
export interface FlawMapBackT {
  lotId: string;
  flawTypeList?: {
    pol?: Array<number>;
    piantiehou?: Array<number>;
    doff?: Array<number>;
  };
}

//-请求类型的参数----查询sheet列表
export interface SheetListBackT {
  lotId: string;
  pageSize: number;
  pageNum: number;
}

//-请求类型的参数--查询某一片的缺陷列表分页
export interface FlawCardBySheetBackT {
  lotId: string;
  layerId: string;
  sheetId: number;
  flawTypeList?: Array<number>;
  pageSize: number;
  pageNum: number;
}

// 查询一片上的缺陷Map图点集合
export interface SheetFlawMapBackT {
  lotId: string;
  sheetId: number;
  layerId: string;
  flawTypeList?: {
    pol?: Array<number>;
    piantiehou?: Array<number>;
    doff?: Array<number>;
  };
}
// 查询某一个缺陷的详细信息
export interface RowFlawInfoBackT {
  lotId: string;
  layerId: string;
  sheetId: number;
  uid: number;
  station: string;
}

// 根据panelId筛选某一片
export interface SelectPanelBackT {
  panelId: string;
  lotId: string;
  pageSize: number;
}
// 点击map图缺陷 返回片列表的pageNum，和缺陷的pageNum
export interface SheetAndFlawSizeT {
  sheetId: number;
  station: string;
  uid: number;
  lotId: string;
  layerId: string;
  flawTypeList?: Array<number>;
  sheetPageSize: number;
  flawPageSize: number;
}

export interface slitHeadBackT {
  direction: string;
  layerId: string;
  lotId: string;
  size: number;
  sizeLong: number;
  sizeShort: number;
  sheetSum: number;
  sheetOkNum: number;
  panelOkNumm: number;
  // 良品率
  okRadio: number;
}

// marking分析
export interface MarkingSelectT {
  startTime?: number;
  endTime?: number;
  // LotId
  layerId?: string;
  markingTypeList?: Array<string>;
  pageSize?: number;
  pageNum?: number;
}

// 综合Map的查询参数
export interface MapLayerSelectT {
  flawTypeList?: {
    pol?: Array<number>;
    piantiehou?: Array<number>;
    doff?: Array<number>;
  };
  layerId: string;
}

// 配置页面查询旋转配置列表参数
export interface RotateConfigQueryT {
  pageNum?: number;
  pageSize?: number;
}

// 查询配置
export interface getRotateConfigT {
  factory: string;
  productLine: string;
}

// 新增、修改配置参数
export interface RotateConfigT {
  factory?: string;
  productLine?: string;
  isReverse?: number;
  angle?: number;
  offsetX?: number;
  offsetY?: number;
  desc?: string;
  genTime?: number;
}

// 配置的历史记录查询参数
export interface RotateConfigHistoryT {
  factory: string; // 厂区
  productLine: string; // 产线
  pageNum?: number; // 页数
  pageSize?: number; // 每页条数
}

export interface FactoryMap {
  factory: string;
  productLine: Array<string>;
}

//分卷对应sheetTable表
export interface Sheet {
  flawCount: number;
  doffMd: number;
  doffCd: number;
  lengthCd: number;
  lengthMd: number;
  paintiehouFlawCount: number;
  panelId: string;
  polFlawCount: number;
  postScreenTime: number;
  sheetId: number;
  lotId?: string;
  isOk?: number;
  exInfo?: string;
}

//缺陷卡片
export interface FlawCard {
  area: number;
  cameraId: string;
  contours: string;
  diameter: number;
  exInfo: string;
  flawType: number;
  uid: number;
  gen_time: number;
  imgPath: string;
  layerId: string;
  lengthCd: number;
  lengthMd: number;
  lotId: string;
  panelId: string;
  sheetId: number;
  x: number;
  y: number;
}

export interface sheetFlaw {
  cardTxt: string;
  flawType: number;
  flawUid: number;
  panelId: string;
  sheetId: number;
  uid: number;
  x: number;
  y: number;
}

export interface SheetFlawMap {
  sheet: Sheet;
  flaws: Array<number | sheetFlaw>;
}

export enum flawMapT {
  sheet = 'sheet',
  lot = 'lot'
}

export interface lotMapEchartT {
  lotId: number;
  sheetId: number;
  uid: number;
  flawType: number;
  station: FlawTypeSiteT;
  value: Array<number>;
  icon?: string;
}

// 跑数据的参数类型
export interface RunDataType {
  type: string;
  content: string;
  station: Array<string>;
  lineName: string;
}
